
import axios from '@/libs/request/axios'

// 获取省市区
export function getLocation(obj) {
    return axios.request({
        url: '/channel/common/getAddressList',
        method: 'POST',
        data: obj
    })
}

export const getAreaValueById = (params) => {
    return axios.request({
        url: '/channel/common/getAreaValueById',
        method: 'post',
        data:params
    });
}
export function getTest(obj) {
    return axios.request({
        url: '/channel/common/getCaseSave',
        method: 'POST',
        data: obj
    })
}
// 通过vin 查询车辆信息
export function getCarByVin(obj) {
    return axios.request({
        url: '/channel/common/getCarByVin',
        method: 'POST',
        data: obj
    })
}

// 获取全部权限数据
export const getAllAddressList = (params) => {
    return axios.request({
        url: `channel/common/getAddressTree`,
        method: 'POST',
        params: params,
    })
}

// 获取车型库数据
export const getAllCarList = (params) => {
    return axios.request({
        url: '/channel/vehicle/getCarTree',
        method: 'POST',
        data: params,
    })
}

export const getDeptInfoByChannelId = (channelId,parentId) => {
    return axios.request({
        url: `/channel/common/getDeptInfo/${channelId}/${parentId}`,
        method: 'post'
    });
}

// 获取车型库数据
export const getAllNewCarList = (parentId) => {
    return axios.request({
        url: `/channel/vehicle/findAllByParentId/${parentId}`,
        method: 'POST',
    })
}

// 获取用户角色
export const getRoleType = (params) => {
    return axios.request({
        url: `channel/roleType/getRoleTypeById`,
        method: 'POST',
        params: params,
    })
}

// 获取合作商名称
export function getBaseInfo(obj) {
    return axios.request({
        url: '/channel/common/getBaseInfo',
        method: 'POST',
        data: obj
    })
}

// 获取合作商名称
export function getBaseInfoPage(obj) {
    return axios.request({
        url: '/channel/common/getBaseInfoPage',
        method: 'POST',
        data: obj
    })
}

// 根据类型获取合作商
export function getBaseInfoByType(obj) {
    return axios.request({
        url: '/channel/common/getBaseInfoByType',
        method: 'POST',
        data: obj
    })
}

// 获取用户角色
export const getApplyUserInfo = (params) => {
    return axios.request({
        url: '/channel/common/getUserInfo',
        method: 'POST',
        data: params,
    })
}

// 获取用户角色
export const getRoleList = (params) => {
    return axios.request({
        url: '/channel/common/getAllByPage',
        method: 'POST',
        data: params,
    })
}

//根据渠道id获取所有的业务员
export const getAllRegionalManager = (roleId,params) => {
    return axios.request({
        url:`/channel/common/getAllRegionalManager/${roleId}`,
        params:params,
        method: 'get'
    })
}


// 通过角色属性获取对应的合作商信息
export function getBaseInfoByRole(obj) {
    return axios.request({
        url: '/channel/common/getBaseInfoByRole',
        method: 'POST',
        data: obj
    })
}


// 获取这个合作商下面被停的新车进件
export const getStopNewApply = (params) => {
    return axios.request({
        url: '/channel/common/getStopNewApply',
        method: 'POST',
        data: params,
    })
}

// 获取这个合作商下面被停的二手车进件
export const getStopOldApply = (params) => {
    return axios.request({
        url: '/channel/common/getStopOldApply',
        method: 'POST',
        data: params,
    })
}

// 获取这个合作商下面被停的新车账户
export const getStopNewUser = (params) => {
    return axios.request({
        url: '/channel/common/getStopNewUser',
        method: 'POST',
        data: params,
    })
}

// 获取这个合作商下面被停的二手车账户
export const getStopOldUser = (params) => {
    return axios.request({
        url: '/channel/common/getStopOldUser',
        method: 'POST',
        data: params,
    })
}

// 停新车二手车进件
export const stopApply = (params) => {
    return axios.request({
        url: '/channel/common/stopApply',
        method: 'POST',
        data: params,
    })
}

// 启新车二手车进件
export const startApply = (params) => {
    return axios.request({
        url: '/channel/common/startApply',
        method: 'POST',
        data: params,
    })
}

// 停新车二手车账户
export const stopUser = (params) => {
    return axios.request({
        url: '/channel/common/stopUser',
        method: 'POST',
        data: params,
    })
}

// 启新车二手车账户
export const startUser = (params) => {
    return axios.request({
        url: '/channel/common/startUser',
        method: 'POST',
        data: params,
    })
}
// 查询车型库数据
export const getVehicleList = (params)  => {
    return axios.request({
        url: `/channel/vehicle/getVehicleList`,
        data: params,
        method: 'post'
    })
}

// 同步车型库数据
export const synchro = (params) => {
    return axios.request({
        url: '/channel/common/synchro',
        method: 'POST',
        data: params,
    })
}

/**
 * 获取影像件挂牌车需要的数据
 * @param params
 * @returns {*}
 */
export const getFilterParams = (params) => {
    return axios.request({
        url: '/channel/channelFilter/getListingCarParams',
        method: 'post',
        data: params
    });
}

// 获取车型库数据(异步)
export const getBrandTree = (params) => {
    return axios.request({
        url: '/channel/vehicle/getBrandTree',
        method: 'POST',
        data: params,
    })
}

// 重置用户密码
export const resetPassWord = (id) => {
    return axios.request({
        url:`/channel/common/resetPassword/${id}`,
        method: 'post'
    })
}

export const senderUser = (params) => {
    return axios.request({
        url: '/channel/common/senderUser',
        method: 'POST',
        data: params,
    })
}

//同步影像件到进件
export const syncFileToApply = (fileId,belongNo,params) => {
    return axios.request({
        url:`/channel/common/syncFileToApply/${fileId}/${belongNo}`,
        params:params,
        method: 'get'
    })
}
